package server.utils;

import java.util.Vector;

import DAO.TotalDao;
import server.main.server_main;

public class GetHistory {
	private int roomId;
	private int userId;
	public GetHistory(int rid, int uid) {
		this.roomId = rid;
		this.userId = uid;
	}
	public Vector<model.Message> getHistory() {
		TotalDao totalDao = new TotalDao(server_main.db.con);
		return totalDao.roomMessages(roomId);
	}
	public Vector<model.Message> getMachineHistory() {
		System.out.println("正在请求历史信息");
		TotalDao totalDao = new TotalDao(server_main.db.con);
		return totalDao.machineMessages(userId);
	}
	// 复用，不再多开一个类了
	public boolean insertMachineMessage(int userId, int isMachine, String mes) {
		TotalDao totalDao = new TotalDao(server_main.db.con);
		return totalDao.machineInsert(userId, isMachine, mes);
	}
}
